﻿<%@ Page Language="C#" MasterPageFile="../Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Admin</title>
</asp:Content>

<asp:Content ID="css_js" ContentPlaceHolderID="js_css" runat="server">
</asp:Content>

<asp:Content ID="head_content" ContentPlaceHolderID="head_content" runat="server">
      <% Html.RenderAction("index","head"); %>
</asp:Content>

<asp:Content ID="indexContentRight" ContentPlaceHolderID="main_content" runat="server">
  <div class="breadcrumb">
    <a href="/admin/home/index">Trang Chủ</a>:: <a href=""> Chỉnh sửa thông tin cá nhân</a>
</div>
<% if (ViewData["success"] != null)
   { %>
<div class="success"><%= Html.Encode(ViewData["success"])%></div>
<%} %>
<% if (ViewData["error"] != null)
   { %>
<div class="warning"><%= Html.Encode(ViewData["error"])%></div>
<%} %>

<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('/admin/content/images/user.png');">Thông tin cá nhân</h1>
    <div class="buttons"><a onclick="check_validate()" class="button"><span>Sửa</span></a><a onclick="location = '/admin/home/index';" class="button"><span>Huỷ bỏ</span></a></div>
  </div>
  <div class="content">
    <form action="/admin/account/edituser" method="post" id="edituser" name="edituser">          
      <table class="form">
        <tbody><tr>
          <td><span class="required">*</span> Tên đăng nhập:</td>
          <td><%= Html.Encode(ViewData["user_name"])%></td>
        </tr>
        <tr>
          <td>E-Mail:</td>
          <td><input name="email" id="email" value="<%= Html.Encode(ViewData["email"])%>" size="50" type="text"/></td>
        </tr>		
        <tr>
          <td>Địa chỉ:</td>
          <td><input name="address" id="address" value="<%= ViewData["address"]%>" size="50" type="text"/>
            </td>
        </tr>
        <tr>
          <td>Điện thoại:</td>
          <td><input name="phone" id="phone" value="<%= Html.Encode(ViewData["phone"])%>" size="50" type="text"/>
            </td>
        </tr>
        <tr>
          <td>CMND:</td>
          <td><input name="cmnd" id="cmnd" value="<%= Html.Encode(ViewData["cmnd"])%>" size="50" type="text"/>
            </td>
        </tr>		
       
      </tbody></table>
    </form>
  </div>
</div>
<script type="text/javascript">
     function check_validate() {
         
         if (document.getElementById("email").value == "") {
             alert('Vui lòng nhập email');
             document.getElementById("email").focus();
             return false;
         }
         else if (checkEmail(document.getElementById("email").value) != true) {
             alert('Email không hợp lệ');
             document.getElementById("email").focus();
             return false;
         }
         else if (document.getElementById("phone").value == "" || isNaN(document.getElementById("phone").value)==true) {
             alert("Số điện thoại chưa nhập hoặc chưa chính xác");
             document.getElementById("phone").focus();
             return false;
         }
         else if (document.getElementById("cmnd").value == "" || isNaN(document.getElementById("cmnd").value)==true) {
             alert("Số cmnd chưa nhập hoặc chưa chính xác");
             document.getElementById("cmnd").focus();
             return false;
         }
         else {
             $('#edituser').submit();
         }

     }
     function checkEmail(value) {
         if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value))
             return true;
         else
             return false;
     }
</script>   
</asp:Content>
